package com.neuedu.advance.instance.of;

/**
 * @author 金山
 * 项目：javase
 * site: https://blog.fulfill.com.cn
 * 描述  启动器
 * @data 2024/10/1713:33
 *
 *
 * 域名的反写     com.xxx.xxx.xxx
 *              com.neuedu.javase.voi
 *              com.neuedu.javase.po
 *              com.neuedu.javase.dto
 *              com.neuedu.javase.domain
 *              com.neuedu.javase.controller
 *              com.neuedu.javase.service
 *              com.neuedu.javase.service.impl
 *              com.neuedu.javase.dao
 *
 *
 *              org.jshand.xxxx.xxx
 */
public class Runner {

    public static void main(String[] args) {


        Human human = new Human("蜘蛛侠");
        human.introduce();





        // Human student = new Student("张飞");
        // student.introduce();

        //向上塑性 自动
        Human human1 = new People("赵云");
        Human human2 = new Student("诸葛亮");


        long lnum = 100;
        int numa = (int) lnum;


        //向下塑性 需要强制转换
        /**
         * Exception in thread "main" java.lang.ClassCastException:
         *      class com.neuedu.advance.instance.of.People
         *          cannot be cast to
         *      class com.neuedu.advance.instance.of.Student
         */

        //判断   human1  到底是不是 student的类型 或者是子类

        if(human1 instanceof Student){
            Student stu1 = (Student)human1;
        }else{
            System.out.println("human1 不是 Student的类型 ");
        }

        if(human2 instanceof Student){
            Student stu2 = (Student)human2;
            stu2.introduce();
        }else{
            System.out.println("human2 不是 Student的类型 ");
        }






    }
}
